﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiSpotLightTraits : OdGiStandardLightTraits
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiSpotLightTraits(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiSpotLightTraits_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiSpotLightTraits obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiSpotLightTraits()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiSpotLightTraits(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiSpotLightTraits cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSpotLightTraits_cast(OdRxObject.getCPtr(pObj));
			OdGiSpotLightTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSpotLightTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSpotLightTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSpotLightTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSpotLightTraits_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSpotLightTraits_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSpotLightTraits_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiSpotLightTraits createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSpotLightTraits_createObject();
			OdGiSpotLightTraits result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSpotLightTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSpotLightTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSpotLightTraits)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setPosition(OdGePoint3d pos)
		{
			GlobalsPINVOKE.OdGiSpotLightTraits_setPosition(this.swigCPtr, OdGePoint3d.getCPtr(pos));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGePoint3d position()
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGiSpotLightTraits_position(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setTargetLocation(OdGePoint3d loc)
		{
			GlobalsPINVOKE.OdGiSpotLightTraits_setTargetLocation(this.swigCPtr, OdGePoint3d.getCPtr(loc));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGePoint3d targetLocation()
		{
			OdGePoint3d result = new OdGePoint3d(GlobalsPINVOKE.OdGiSpotLightTraits_targetLocation(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool setHotspotAndFalloff(double hotspot, double falloff)
		{
			bool result = GlobalsPINVOKE.OdGiSpotLightTraits_setHotspotAndFalloff(this.swigCPtr, hotspot, falloff);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double hotspot()
		{
			double result = GlobalsPINVOKE.OdGiSpotLightTraits_hotspot(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double falloff()
		{
			double result = GlobalsPINVOKE.OdGiSpotLightTraits_falloff(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiLightAttenuation lightAttenuation()
		{
			OdGiLightAttenuation result = new OdGiLightAttenuation(GlobalsPINVOKE.OdGiSpotLightTraits_lightAttenuation(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setAttenuation(OdGiLightAttenuation atten)
		{
			GlobalsPINVOKE.OdGiSpotLightTraits_setAttenuation(this.swigCPtr, OdGiLightAttenuation.getCPtr(atten));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setPhysicalIntensity(double fIntensity)
		{
			GlobalsPINVOKE.OdGiSpotLightTraits_setPhysicalIntensity(this.swigCPtr, fIntensity);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual double physicalIntensity()
		{
			double result = GlobalsPINVOKE.OdGiSpotLightTraits_physicalIntensity(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setLampColor(OdGiColorRGB color)
		{
			GlobalsPINVOKE.OdGiSpotLightTraits_setLampColor(this.swigCPtr, OdGiColorRGB.getCPtr(color));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdGiColorRGB lampColor()
		{
			OdGiColorRGB result = new OdGiColorRGB(GlobalsPINVOKE.OdGiSpotLightTraits_lampColor(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
